package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 复盘单明细表，记录复盘单的产品明细
 * @TableName inventory_recheck_item
 */
@TableName(value ="inventory_recheck_item")
@Data
public class InventoryRecheckItem implements Serializable {
    /**
     * 主键ID，明细的唯一标识，用于在系统中唯一确定一条复盘单明细记录
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 复盘单ID，关联复盘单表的ID，表明该明细属于哪张复盘单
     */
    private Long recheckId;

    /**
     * 产品ID，关联产品表的ID，表明该明细涉及的产品
     */
    private Long productId;

    /**
     * 账面数量，该产品在系统中的账面库存数量（基于上次盘点结果）
     */
    private BigDecimal quantity;

    /**
     * 实际数量，该产品在实际复盘中的数量
     */
    private BigDecimal actualQuantity;

    /**
     * 备注信息，用于记录与该复盘明细相关的额外说明，如复盘差异原因等
     */
    private String remark;

    /**
     * 系统数量（非数据库字段，用于显示当前系统库存数量）
     */
    @TableField(exist = false)
    private BigDecimal systemQuantity;

    /**
     * 产品名称（非数据库字段，用于显示）
     */
    @TableField(exist = false)
    private String productName;

    /**
     * 产品编码（非数据库字段，用于显示）
     */
    @TableField(exist = false)
    private String productCode;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        InventoryRecheckItem other = (InventoryRecheckItem) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRecheckId() == null ? other.getRecheckId() == null : this.getRecheckId().equals(other.getRecheckId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
            && (this.getActualQuantity() == null ? other.getActualQuantity() == null : this.getActualQuantity().equals(other.getActualQuantity()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRecheckId() == null) ? 0 : getRecheckId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
        result = prime * result + ((getActualQuantity() == null) ? 0 : getActualQuantity().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", recheckId=").append(recheckId);
        sb.append(", productId=").append(productId);
        sb.append(", quantity=").append(quantity);
        sb.append(", actualQuantity=").append(actualQuantity);
        sb.append(", remark=").append(remark);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}